<template>
  <div>
    <div class="header">
      <span class="search-header">搜索用户数</span>
      <i class="el-icon-warning-outline" />
    </div>
    <div class="main">
      <span class="main-title">12121</span>
      <span class="main-content">17.1</span>
      <i v-if="false" class="el-icon-caret-bottom" />
      <i class="el-icon-caret-top" />
    </div>
    <div class="footer">
      <template>
        <div ref="charts" class="charts" />
      </template>
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts'
export default {
  name: 'LineCharts',
  mounted() {
    const lineCharts = echarts.init(this.$refs.charts)
    lineCharts.setOption({
      xAxis: {
        // 隐藏X轴
        show: false,
        type: 'category'
      },
      yAxis: {
        // 隐藏Y轴
        show: false
      },
      series: [
        {
          type: 'line',
          data: [10, 7, 33, 12, 88, 9],
          // 拐点的样式设置
          itemStyle: {
            opacity: 0
          },
          // 线条的样式
          lineStyle: {
            color: 'purple'
          },
          // 填充颜色
          areaStyle: {
            color: {
              type: 'linear',
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [{
                offset: 0, color: 'purple' // 0% 处的颜色
              }, {
                offset: 1, color: '#fff' // 100% 处的颜色
              }],
              global: false // 缺省为 false
            }
          }
        }
      ],
      grid: {
        left: 0,
        top: 0,
        right: 0,
        bottom: 0
      }
    })
  }
}
</script>

<style scoped>
.header {
    display:flex;
    align-items: center;
}
.search-header{
  margin-right: 20px;
  padding: 15px 0px;
}
.main{
  margin-right: 30px;
}
.main-title{
  margin-right: 30px;
}
.main-content{
  margin-right: 5px;
}
.charts{
  width: 100%;
  height: 100px;
}
</style>
